package com.zlsy.springbootdemo.abstractfactory.demo.color;

import com.zlsy.springbootdemo.abstractfactory.demo.AbstractFactory;
import com.zlsy.springbootdemo.abstractfactory.demo.shape.Shape;

/**
 * @author zhouliang
 * @date 2021/1/22 10:16
 */
public class ColorFactory extends AbstractFactory {

  @Override
  public Color getColor(String color) {
    if (color == null) {
      return null;
    }
    if (color.equalsIgnoreCase("RED")) {
      return new Red();
    } else if (color.equalsIgnoreCase("GREEN")) {
      return new Green();
    } else if (color.equalsIgnoreCase("BLUE")) {
      return new Blue();
    }
    return null;
  }

  @Override
  public Shape getShape(String shape) {
    return null;
  }
}
